<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/jquery.js"></script>
    <style>
        div{
            background-color: red;
            height: 800px;
            width: 3000px;
            background-image: url('../img/快乐加倍.png');
            background-size: contain;
        }

        img{
            position:fixed;
            top:20%;
            left:30%;
            width: 300px;
            height: 300px;
            display: none;
        }

    </style>
    <script>
        $(window).scroll( function() { 
            console.log($(window).scrollLeft());
            let left = $(window).scrollLeft()
            if(left >= 500 && left <= 800 ){
                // alert()
                $("#img1").css({ "background": "blue" });
                $("#img1").show('slow')
               
            }else if(left > 800){
                $("#img1").hide('slow')
            }else if(left >= 1000 && left <= 1300){
                $("#img1").show('slow')
                $("#img1").attr("src","../img/greenbtn.png");
            }else{
                $("#img1").hide('slow')
            }
           
        } );
    </script>
    <img src="../img/java.png" alt="" id="img1">
</head>
<body>
    <div>

    </div>
</body>
</html>